package net.gdface.facelog.decorator.client;
import net.gdface.facelog.Token.TokenType;
import net.gdface.thrift.ThriftDecorator;
import net.gdface.thrift.TypeTransformer;
import com.facebook.swift.codec.ThriftStruct;
import com.facebook.swift.codec.ThriftField;
import com.facebook.swift.codec.ThriftField.Requiredness;
/**
 * decorator pattern 装饰者模式client端代理{@link net.gdface.facelog.Token}<br>
 * 代理对象必须有默认构造方法,必须是普通类型,不可以有@ThriftStruct注释<br>
 * 转发所有{@link net.gdface.facelog.Token}get/set方法到{@link #delegate()}指定的实例,<br>
 * 计算机生成代码(generated by automated tools ThriftServiceDecoratorGenerator @author guyadong)<br>
 * @author guyadong
 *
 */
@ThriftStruct
public final class Token implements ThriftDecorator<net.gdface.facelog.Token> {
    private final net.gdface.facelog.Token delegate;
    
    public Token(){
        this(new net.gdface.facelog.Token());
    }
    public Token(net.gdface.facelog.Token delegate) {
        if(null == delegate){
            throw new NullPointerException("delegate is null");
        }
        // 检查被装饰类是否有@ThriftStruct注释
        if(delegate.getClass().isAnnotationPresent(ThriftStruct.class)){
            throw new IllegalArgumentException(
                String.format("NOT ALLOW %s have @ThriftStruct annotation",delegate.getClass().getName()));
        }
        this.delegate = delegate;
    }

    /**
     * 返回被装饰的{@link net.gdface.facelog.Token}实例
     * @return
     */
    @Override
    public net.gdface.facelog.Token delegate() {
        return delegate;
    }
    @Override
    public int hashCode() {
        return delegate().hashCode();
    }
    @Override
    public boolean equals(Object obj) {
        return delegate().equals(obj);
    }
    @Override
    public String toString() {
        return delegate().toString();
    }
    @ThriftField(value = 1,requiredness=Requiredness.REQUIRED)
    public int getId(){
        return delegate().getId();
    }
    
    @ThriftField
    public void setId(int value){
        delegate().setId(value);
    }

    @ThriftField(value = 2,requiredness=Requiredness.REQUIRED)
    public int getT1(){
        return delegate().getT1();
    }
    
    @ThriftField
    public void setT1(int value){
        delegate().setT1(value);
    }

    @ThriftField(value = 3,requiredness=Requiredness.REQUIRED)
    public int getT2(){
        return delegate().getT2();
    }
    
    @ThriftField
    public void setT2(int value){
        delegate().setT2(value);
    }

    @ThriftField(value = 4,requiredness=Requiredness.REQUIRED)
    public int getT3(){
        return delegate().getT3();
    }
    
    @ThriftField
    public void setT3(int value){
        delegate().setT3(value);
    }

    @ThriftField(value = 5,requiredness=Requiredness.REQUIRED)
    public int getT4(){
        return delegate().getT4();
    }
    
    @ThriftField
    public void setT4(int value){
        delegate().setT4(value);
    }

    @ThriftField(value = 6,requiredness=Requiredness.OPTIONAL)
    public net.gdface.facelog.client.thrift.TokenType getType(){
        return TypeTransformer.getInstance().to(
                    delegate().getType(),
                    TokenType.class,
                    net.gdface.facelog.client.thrift.TokenType.class);
    }
    
    @ThriftField
    public void setType(net.gdface.facelog.client.thrift.TokenType value){
        delegate().setType(TypeTransformer.getInstance().to(
                    value,
                    net.gdface.facelog.client.thrift.TokenType.class,
                    TokenType.class));
    }

}